let ClubApp = new Vue({
    el: '#ClubApp',
    data: {
     //   id:0,
        clubs: []
    },
    methods: {
        loadClubs: function () {
            $.ajax({
                url: '/portal/club',
                success: function (r) {
                    ClubApp.clubs = r.data;
                }
            });
        },
        delect: function (id) {
            //   alert(id)
            $.ajax({
                url: '/portal/club/delete',
                data: 'id=' + id,
                success: function (r) {
                    if (r.state == 2000) {
                        alert('删除成功！');
                        location.href = "/index.html"
                    } else {
                        alert(r.message);
                    }
                },
            });
        },
        updateQuestion: function () {
            //   alert("准备提交注册……");

            $.ajax({
                url: '/portal/question/list/update',
                type: 'post',
                data:{
                    id:this.id,
                    clubname:$('#clubname').val(),
                    name:$('#name').val(),
                    vcount:$('#vcount').val(),
                },
                success: function (r) {
                    if (r.state == 2000) {
                        alert('修改成功！');
                        location.href="/index.html"
                    } else {
                        alert(r.message);

                    }
                },
                error: function () {
                    alert('程序运行出错，请打开浏览器的控制台检查错误，如果提示500错误，还需要检查服务器端的控制台！');
                }
            });
        },
    },

    created: function () {
        this.loadClubs();
        let id=location.search.substring(1);
        this.id=id;
    }
});
